package com.woniuxy.education.service.impl;

import com.woniuxy.education.entity.*;
import com.woniuxy.education.mapper.SchoolMapper;
import com.woniuxy.education.mapper.UserMapper;
import com.woniuxy.education.service.SchoolService;
import com.woniuxy.education.service.UserService;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.sql.DataSource;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

@Service
public class SchoolServiceImpl implements SchoolService {

    @Autowired
    SchoolMapper schoolMapper;

    @Override
    public List<Allschool> findAllSchool() {
        List<Allschool> allschools = schoolMapper.findAllSchool();
        return allschools;
    }

    @Override
    public Allschool findSchool(String school_account, String school_password) {


        return schoolMapper.findSchool(school_account,school_password);
    }

    @Override
    public boolean updateSchool(int id, String school_password) {

        int result = schoolMapper.updateSchool(id,school_password);

        return result>0?true:false;
    }

    @Override
    public boolean updateSchoolMaster(int uid, String password) {

        int result = schoolMapper.updateSchoolMsater(uid,password);

        return result>0?true:false;
    }

    @Override
    public List<School_Contrast> findAllSchoolContrast() {
        List<School_Contrast> school_contrasts = schoolMapper.findAllSchoolContrast();
        return school_contrasts;
    }

}
